import service from "@/server/serviceIndex";
//根据用户id查询 用户收藏的商品列表
export const getCollectListAPI = (page, limit, userId) => {
  return service({
    url: `/pipayshopapi/collection/selectAllCollection/${page}/${limit}/${userId}`,
  });
};

/*
item
*/
//根据用户id查询 用户关注的网店列表
export const getFollowListAPI = (userId, page, limit) => {
  return service({
    url: `/pipayshopapi/shop/followList/${userId}?page=${page}&limit=${limit}`,
  });
};

// 根据用户id查询用户浏览商品历史-网店
export const getHistoryItemListAPI = ( page, limit,userId) => {
  return service({
    url: `/pipayshopapi/history/getHistory/${page}/${limit}/${userId}`,
  });
};

// 根据用户id查询用户浏览商品申请记录
// export const getCommoditYListAPI = (userId, status) => {
//   return service({
//     url: `/pipayshopapi/item-commodity-info/examineCommodityList/${userId}?examineStatus=${status}`,
//   });
// };

// 根据用户id查询用户浏览商品申请记录
export const getCommoditYListAPI = (itemId) => {
  return service({
    method: "get",
    url: `/pipayshopapi/item-commodity-info/examineCommodityList/${itemId}`,
  });
};

/**
 * #网店商品发布的三个接口
 */
// 商品发布接口
export const issueItemCommodity = (data) => {
  return service({
    method: "post",
    url: `/pipayshopapi/commodity/SaveOrUpdate`,
    data,
  });
};

// 网店头像图片上传
export const itemTopImags = (data) => {
  return service({
    method: "post",
    url: `/pipayshopapi/item-commodity-info/itemTopImags`,
    data,
    headers: { "Content-Type": "multipart/form-data" },
  });
};

// 商品详情图片上传
export const itemDetailImagsUp = (data) => {
  return service({
    method: "post",
    url: `/pipayshopapi/commodity/itemDetailImagsUp`,
    headers: { "Content-Type": "multipart/form-data" },
    data,
  });
};

// 商品图片的轮播上传
export const itemImagsListUp = (data) => {
  return service({
    method: "post",
    url: '/pipayshopapi/commodity/shopImagsListUp',
    headers: { "Content-Type": "multipart/form-data" },
    data,

  });
};

/**
 * #网店商品发布的四个接口
 *
 */
//根据用户id查询实体店列表(我的)
export const getShopListAPI = (limit, page, uid) => {
  return service({
    method: "get",
    url: `/pipayshopapi/shop-info/getShopList?limit=${limit}&page=${page}&uid=${uid}`,
  });
};

//新增用户浏览网店商品的历史记录
export const addHistoryAPI = (commodityId, userId) => {
  return service({
    method: "post",
    url: `/pipayshopapi/history/addHistory?commodityId=${commodityId}&userId=${userId}`,
  });
};

//删除网店商品
export const delCommodityAPI = (commodityId) => {
  return service({
    method: "delete",
    url: `/pipayshopapi/commodity/delCommodity/${commodityId}`,
  });
};
